package com.yilifang.controller;

import com.yilifang.config.result.Result;
import com.yilifang.config.result.ResultGenerator;
import com.yilifang.service.OaNewsApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zhuan on 2018-09-19.
 */
@RestController
@RequestMapping("/daOaNewsAnnounce")
public class OaNewsController {

    @Autowired
    OaNewsApiService oaNewsApiService;
    /**
     * OA新闻公告list
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/OANewsList")
    public Result oaNewsList(@RequestParam(value = "page",defaultValue = "1") Integer page,
                               @RequestParam(value = "size",defaultValue = "5") Integer size){

        return ResultGenerator.genSuccessResult(oaNewsApiService.getOANewsList(page,size));
    }

    /**
     * OA新闻内容
     * @param id
     * @return
     */
    @GetMapping("/OANewsHtml")
    public Result oaNewsHtml(@RequestParam(value = "id") String id){

        return ResultGenerator.genSuccessResult(oaNewsApiService.getOANewsBody(id));
    }
}
